package codeComposition;

import java.util.ArrayList;

public class ModelElement extends ObjectElement {
	ArrayList<ImportElement> imports = new ArrayList<ImportElement>();
	ArrayList<ExpressionElement> expressions = new ArrayList<ExpressionElement>();
	ArrayList<ClassElement> classes = new ArrayList<ClassElement>();

	public ModelElement(String s){
		super(s);
	}
	
	public void addImport(ImportElement ie){
		this.imports.add(ie);
	}
	public void addExpression(ExpressionElement ee){
		this.expressions.add(ee);
	}
	public void addClass(ClassElement ce){
		this.classes.add(ce);
	}
	
	public String toString(){
		String str = "";
		if(this.imports.size() != 0){
			for(ImportElement ie:this.imports){
				str += ie.toString();
			}
			str += "\n";
		}
		if(this.expressions.size() != 0){
			for(ExpressionElement ie:this.expressions){
				ie.setTabNum(0);
				str += ie.toString();
			}
			str += "\n";
		}
		if(this.classes.size() != 0){
			for(ClassElement ie:this.classes){
				str += ie.toString();
			}
			str += "\n";
		}
		return str;
	}
}
